package com.example.app.components.MyButton

import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.FloatingActionButtonDefaults
import androidx.compose.material3.FloatingActionButtonElevation
import androidx.compose.material3.contentColorFor
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.tooling.preview.Preview
import com.example.app.components.MyText.MyText

//注意，modifier = Modifier.size，只有在box容器下，才生效

@Composable
fun MyFloatingActionButton(
        onClick: () -> Unit,
        modifier: Modifier = Modifier,
        shape: Shape = FloatingActionButtonDefaults.shape,
        containerColor: Color = FloatingActionButtonDefaults.containerColor,
        contentColor: Color = contentColorFor(containerColor),
        elevation: FloatingActionButtonElevation = FloatingActionButtonDefaults.elevation(),
        interactionSource: MutableInteractionSource? = null,
        content: @Composable () -> Unit,
) {
    FloatingActionButton(
        onClick,
        modifier,
        shape,
        containerColor,
        contentColor,
        elevation,
        interactionSource,
        content,
    )
}

@Preview
@Composable
fun MyFloatingActionButtonDemo() {
    MyFloatingActionButton(
        onClick = { /*TODO*/ },
    ) {
        MyText(text = "测试按钮")
    }
}